
local S = mobs.intllib


-- Stone Monster by PilzAdam

mobs:register_mob("mobs_monster:stone_monster", {
	type = "monster",
	passive = false,
	attack_type = "dogfight",
	pathfinding = true,
	reach = 2,
	damage = 7,
	hp_min = 60,
	hp_max = 80,
	armor = 30,
	collisionbox = {-0.4, -1.2, -0.4, 0.4, 0.9, 0.4},
	visual_size = {x=1.25, y=1.25},
	visual = "mesh",
	mesh = "mobs_stone_monster.b3d",
	textures = {
		{"mobs_stone_monster.png"},
	},
	blood_texture = "mobs_stone_monster_blood.png",
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_stonemonster",
		damage = "mobs_stonemonster_damage",
	},
	walk_velocity = 1,
	run_velocity = 2,
	fear_height = 5,
	jump_height = 1.50,
	stepheight = 1.1,
	floats = 0,
	view_range = 25,
	drops = {
		{name = "default:cobble", chance = 1, min = 7, max = 13},
		{name = "default:coal_lump", chance = 1, min = 6, max = 12},
	},
	water_damage = 0,
	lava_damage = 35,
	light_damage = 0,
	animation = {
		speed_normal = 15,
		speed_run = 15,
		stand_start = 0,
		stand_end = 14,
		walk_start = 15,
		walk_end = 38,
		run_start = 40,
		run_end = 63,
		punch_start = 40,
		punch_end = 63,
	},
	
	immune_to = {
		{"default:pick_wood", 0},
		{"default:pick_stone", 0},
		{"default:pick_bronze", 1},
		{"default:pick_steel", 1},
		{"default:pick_mese", 3},
		{"default:pick_diamond", 2},
		{"ethereal:pick_crystal", 2},
		{"mobs:pick_lava", 2},
	},
	
	on_die = function(self, pos)

		local cod = self.cause_of_death or {}
		local def = cod.node and minetest.registered_nodes[cod.node]

		if def and def.groups and def.groups.lava then

			pos.y = pos.y + 1

			mobs:effect(pos, 40, "tnt_smoke.png", 3, 5, 2, 0.5, nil, false)

			minetest.sound_play("mobs_explode",
				{pos = pos, max_hear_distance = 12, gain = 1.5}, true)

			self.object:remove()

				if math.random(2) == 1 then
				mobs:add_mob(pos, {
					name = "mobs_monster:magma_monster",
				})
			end
		end
	end,
})

if not mobs.custom_spawn_monster then
mobs:spawn({
	name = "mobs_monster:stone_monster",
	nodes = {"default:stone", "default:desert_stone", "default:sandstone"},
	max_light = 0,
	chance = 6000,
	max_height = -10,
})
end

mobs:register_egg("mobs_monster:stone_monster", S("Stone Monster"), "default_stone.png", 1)


mobs:alias_mob("mobs:stone_monster", "mobs_monster:stone_monster") -- compatibility


mobs:register_mob("mobs_monster:magma_monster", {
	type = "monster",
	passive = false,
	attack_type = "dogfight",
	pathfinding = true,
	reach = 2,
	damage = 7,
	hp_min = 160,
	hp_max = 180,
	armor = 20,
	collisionbox = {-0.4, -1, -0.4, 0.4, 0.9, 0.4},
	visual_size = {x=1, y=1},
	visual = "mesh",
	mesh = "mobs_stone_monster.b3d",
	textures = {
		{"mobs_magma_monster.png"},
	},
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_stonemonster",
		damage = "mobs_stonemonster_damage",
	},
	walk_velocity = 1,
	run_velocity = 2,
	fear_height = 5,
	jump_height = 1.50,
	stepheight = 1.1,
	floats = 0,
	view_range = 50,
	drops = {
		{name = "default:stone", chance = 1, min = 16, max = 23},
		{name = "default:coal_lump", chance = 1, min = 6, max = 12},
	},
	water_damage = 0,
	lava_damage = -5,
	light_damage = 0,
	animation = {
		speed_normal = 15,
		speed_run = 15,
		stand_start = 0,
		stand_end = 14,
		walk_start = 15,
		walk_end = 38,
		run_start = 40,
		run_end = 63,
		punch_start = 40,
		punch_end = 63,
	},
	
	immune_to = {
		{"default:pick_wood", 0},
		{"default:pick_stone", 0},
		{"default:pick_bronze", 1},
		{"default:pick_steel", 3},
		{"default:pick_mese", 1},
		{"default:pick_diamond", 2},
		{"ethereal:pick_crystal", 2},
		{"mobs:pick_lava", 2},
	},
})